#ifndef CONNECTIONDIALOG_H
#define CONNECTIONDIALOG_H

#include <QDialog>
#include <QLineEdit>
#include <QComboBox>
#include <QSpinBox>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QString>

class ConnectionDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ConnectionDialog(QWidget *parent = nullptr);
    
    QString getConnectionName() const;
    QString getDriver() const;
    QString getHost() const;
    QString getDatabase() const;
    QString getUsername() const;
    QString getPassword() const;
    int getPort() const;
    
    void setConnectionName(const QString &name);
    void setDriver(const QString &driver);
    void setHost(const QString &host);
    void setDatabase(const QString &database);
    void setUsername(const QString &username);
    void setPassword(const QString &password);
    void setPort(int port);
    
    bool isEditMode() const;
    void setEditMode(bool editMode);

private slots:
    void validateInput();

private:
    void setupUI();
    void setupConnections();
    
    QLineEdit *m_nameEdit;
    QComboBox *m_driverCombo;
    QLineEdit *m_hostEdit;
    QLineEdit *m_databaseEdit;
    QLineEdit *m_usernameEdit;
    QLineEdit *m_passwordEdit;
    QSpinBox *m_portSpinBox;
    QCheckBox *m_savePasswordCheck;
    QDialogButtonBox *m_buttonBox;
    
    bool m_editMode;
};

#endif // CONNECTIONDIALOG_H